package com.lwm.base;

/**
 * @author liweimin
 * @date 2020/9/23 14:34
 * @description
 */
public class Bobbo {
    public static void BobboSort(int[] array) {
        int tmp = -1;
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = 0; j < array.length - 1 - i; j++) {
                if (array[j] > array[j + 1]) {
                    tmp = array[j];
                    array[j + 1] = tmp;
                    array[j] = array[j + 1];
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] a = {1, 32, 54, 756, 3125, 63, 321, 5, 435, 436, 4523, 423, 423, 423423, 423, 42, 543534};
        BobboSort(a);
        for (int i : a) {
            System.out.println(i);
        }
        //冒泡排序优化
    }
}
